var mySwiper = new Swiper('.swiper-container', {
    loop: true,
    pagination: {
        el: '.swiper-pagination',
    },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
});

var vm = new Vue({
    el: '.m-mask',
    data: {
        params:{
            name: "",
            tel: "",
            addr: "",
            xiaoqu: "",
            other: ""
        }
    },
    methods: {
        ly() {
            let _this = this;
            axios
                .post("/api/web/ly", _this.params)
                .then(data => {
                    let filterData = data.data;
                    if (filterData) {
                        alert("提交成功");
                        $('.m-mask').hide();
                    }
                })
                .catch(error => {
                    console.log(error);
                });
        },

        checkForm() {
            var _this = this;

            let fm = document.form;

            if (_this.params.name == "") {
                alert('姓名不能为空')
                fm.name.focus();
                return false;
            }

            if (_this.params.tel == "" || _this.params.tel.length != 11) {
                alert("请正确填写手机号");
                fm.tel.focus();
                return false;
            }

            if (_this.params.addr == "") {
                alert("房屋地址不能为空");
                fm.addr.focus();
                return false;
            }

            if (_this.params.xiaoqu == "") {
                alert("小区不能为空");
                fm.xiaoqu.focus();
                return false;
            }

            if (_this.params.ohter == "") {
                alert("请简要填写大概情况");
                fm.other.focus();
                return false;
            }

            this.ly();
        }
    },
    created: function () {

    },
    mounted: function () {
    },
    updated: function () {
    }
});

//弹窗
$('.btn-join').on('click', function () {
    $('.m-mask').show();
});
$('.m-mask').on('click', function () {
    $('.m-mask').hide();
});
$('.m-mask-div').on('click', function (e) {
    e.stopPropagation();
});
